#include "widget.h"
#include "ui_widget.h"
#include <QMessageBox>
Widget::Widget(QWidget *parent, SenderWidget *sw, ReceiverWidget *rw)
    : QWidget(parent)
    , ui(new Ui::Widget)
    , senderwidget(sw)
    , receiverwidget(rw)
{
    ui->setupUi(this);
    this->setWindowTitle("Desk Share");
}

Widget::~Widget()
{
    delete ui;
}

void Widget::on_enterSender_btn_clicked()
{
    if(ui->lineEdit_name->text().isEmpty())
    {
        QMessageBox::information(nullptr, "Error", "请输入昵称~");
        return;
    }
    senderwidget = new SenderWidget(nullptr, ui->lineEdit_name->text());
    senderwidget->show();

    this->close();
}


void Widget::on_enterReceiver_btn_clicked()
{
    if(ui->lineEdit_name->text().isEmpty())
    {
        QMessageBox::information(nullptr, "Error", "请输入昵称~");
        return;
    }
    receiverwidget = new ReceiverWidget(nullptr, ui->lineEdit_name->text());
    receiverwidget->show();

    this->close();
}

